package org.erp.common.enums;

import lombok.Getter;

/**
 * 系统是否
 *
 * @author libin
 * @version 1.0
 * @description: 系统是否
 * @date 2025/11/6 14:54
 **/
@Getter
public enum SysWhetherEnum {
    NO(0, "否"),
    YES(1, "是");
    private final Integer code;
    private final String message;

    SysWhetherEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static Integer getCodeByMessage(String message) {
        for (SysWhetherEnum item : SysWhetherEnum.values()) {
            if (item.getMessage().equals(message)) {
                return item.getCode();
            }
        }
        return null;
    }

    public static String getMessageByCode(Integer code) {
        for (SysWhetherEnum item : SysWhetherEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getMessage();
            }
        }
        return null;
    }
}
